﻿@using BootstrapBlazor.Shared.Samples;
@inject IStringLocalizer<Foo> LocalizerFoo
@inject IStringLocalizer<LabelsValidateForm2> Localizer
@inject IStringLocalizer<ValidateForms> LocalizerForm

<div>
    <p>@((MarkupString)Localizer["LabelsValidateForm2Description1"].Value)</p>
    <ValidateForm Model="@Dummy">
        <div class="row g-3">
            <div class="col-sm-12 col-md-6">
                <BootstrapInput @bind-Value="Dummy.Name" />
            </div>
            <div class="col-sm-12 col-md-6">
                <BootstrapInput @bind-Value="Dummy.Address" />
            </div>
        </div>
    </ValidateForm>

    <p class="mt-3">@((MarkupString)Localizer["LabelsValidateForm2Description2"].Value)</p>
    <ValidateForm Model="@Dummy" ShowLabel="false">
        <div class="row g-3">
            <div class="col-sm-12 col-md-6">
                <BootstrapInput @bind-Value="Dummy.Name" />
            </div>
            <div class="col-sm-12 col-md-6">
                <BootstrapInput @bind-Value="Dummy.Address" />
            </div>
        </div>
    </ValidateForm>

    <p class="mt-3">@((MarkupString)Localizer["LabelsValidateForm2Description3"].Value)</p>
    <ValidateForm Model="@Dummy">
        <div class="row g-3 form-inline">
            <div class="col-sm-12 col-md-6">
                <BootstrapInput @bind-Value="Dummy.Name" />
            </div>
            <div class="col-sm-12 col-md-6">
                <BootstrapInput @bind-Value="Dummy.Address" />
            </div>
        </div>
    </ValidateForm>

    <p class="mt-3">@((MarkupString)Localizer["ValidateFormAlignRight"].Value)</p>
    <ValidateForm Model="@Dummy">
        <div class="row g-3 form-inline form-inline-end">
            <div class="col-sm-12 col-md-6">
                <BootstrapInput @bind-Value="Dummy.Name" />
            </div>
            <div class="col-sm-12 col-md-6">
                <BootstrapInput @bind-Value="Dummy.Address" />
            </div>
        </div>
    </ValidateForm>

    <p class="mt-3">@((MarkupString)Localizer["ValidateFormAlignCenter"].Value)</p>
    <ValidateForm Model="@Dummy">
        <div class="row g-3 form-inline form-inline-center">
            <div class="col-sm-12 col-md-6">
                <BootstrapInput @bind-Value="Dummy.Name" />
            </div>
            <div class="col-sm-12 col-md-6">
                <BootstrapInput @bind-Value="Dummy.Address" />
            </div>
        </div>
    </ValidateForm>

    <p class="mt-3">
        @((MarkupString)Localizer["LabelsValidateForm2Description4"].Value)
        <div>@((MarkupString)LocalizerForm["FormLabelWidth"].Value)</div>
        <div class="mt-2">@((MarkupString)LocalizerForm["LongDisplayDescription"].Value)</div>
    </p>
    <ValidateForm Model="@Dummy">
        <div class="row g-3">
            <div class="col-12">
                <BootstrapInput @bind-Value="@Dummy.Name" DisplayText="@LocalizerForm["LongDisplayText"]" />
            </div>
        </div>
        <div class="row g-3 form-inline mt-0">
            <div class="col-12">
                <BootstrapInput @bind-Value="@Dummy.Address" DisplayText="@LocalizerForm["LongDisplayText"]" ShowLabelTooltip="true" />
            </div>
        </div>
    </ValidateForm>
</div>

@code {
    [NotNull]
    private Foo? Dummy { get; set; }

    /// <summary>
    /// OnInitialized 方法
    /// </summary>
    protected override void OnInitialized()
    {
        base.OnInitialized();

        Dummy = Foo.Generate(LocalizerFoo);
    }
}
